package org.devocean.groupbuying.service.impl;

import java.util.List;

import org.devocean.groupbuying.dao.SerialKeyDAO;
import org.devocean.groupbuying.domain.Customer;
import org.devocean.groupbuying.domain.SerialKey;
import org.devocean.groupbuying.service.SerialKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class SerialKeyServiceImpl implements SerialKeyService {

	@Autowired
	private SerialKeyDAO serialKeyDAO;
	
	
	@Transactional
	public List<SerialKey> getSerialKeyByCustomer(Customer customer,Integer start,Integer limit) {
		
		return serialKeyDAO.findSerialKeyByCustomer(customer.getCustomerID(),start,limit);
	}


	public Long countSerialKeyByCustomer(Integer customerID) {
		
		return serialKeyDAO.countSerialKeyByCustomer(customerID);
	}


	public List<SerialKey> getSerialKeyByCustomerByExpireDate(
			Integer customerID, Integer start, Integer limit) {
		
		return serialKeyDAO.findSerialKeyByCustomerByExpireDate(customerID, start, limit);
	}


	public Long countSerialKeyByCustomerByExpireDate(Integer customerID) {
		
		return serialKeyDAO.countSerialKeyByCustomerByExpireDate(customerID);
	}


	public List<SerialKey> getSerialKeyByCustomerByPurchaseDate(
			Integer customerID, Integer start, Integer limit) {
		
		return serialKeyDAO.findSerialKeyByCustomerByPurchaseDate(customerID, start, limit);
	}


	public Long countSerialKeyByCustomerByPurchaseDate(Integer customerID) {
		
		return serialKeyDAO.countSerialKeyByCustomerByPurchaseDate(customerID);
	}


	public SerialKey getSerialKeyById(Integer id) {
		
		return serialKeyDAO.findSerialKeyById(id);
	}


	public SerialKey updateSerialKey(SerialKey serialKey) {
		return serialKeyDAO.updateSerialKey(serialKey);
	}

}
